package client.control;

import client.connect.HttpConnect;
import com.alibaba.fastjson.JSONObject;

import java.io.File;
import java.util.Map;

/**
  * @Description 联网控制
  * @author 孔明浩
  * @Date 2020/4/8
  */
public class ConnectControl {
    HttpConnect connect = new HttpConnect();
    int code;
    String data;
    String message;

    public void doPost(String url, String token, Map<String, String> params) {
        String result = connect.doPost(url,token,params);
        JSONObject object = JSONObject.parseObject(result);
        code = object.getInteger("code");
        data = object.getString("data");
        message = object.getString("message");
    }

    public void doPost(String url, String token, Map<String, String> params, Map<String, File> files){
        String result = connect.doPost(url,token,params,files);
        JSONObject object = JSONObject.parseObject(result);
        code = object.getInteger("code");
        data = object.getString("data");
        message = object.getString("message");
    }
}
